-
Notifications
You must be signed in to change notification settings - Fork 21
CMFSUPPORT-3765: COVERITY TEST. DO NOT MERGE #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR appears to be a test change for Coverity analysis and is explicitly marked "DO NOT MERGE" in both the title and description. The change modifies a sprintf_s call to add an extra format specifier without providing a corresponding argument, introducing a critical bug.
Changes:
- Modified sprintf_s format string to add a third "%s" specifier without providing a third argument
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| else | ||
| { | ||
| rc = sprintf_s(pFullName, sizeof(pFullName), "%s%s", pRootName, buffer); | ||
| rc = sprintf_s(pFullName, sizeof(pFullName), "%s%s%s", pRootName, buffer); |
Copilot
AI
Feb 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change introduces a critical bug. The format string now contains three format specifiers ("%s%s%s") but only two arguments are provided (pRootName and buffer). This mismatch will cause undefined behavior when sprintf_s attempts to read a third argument that doesn't exist, potentially leading to crashes or memory corruption.
The original code with two format specifiers ("%s%s") correctly matched the two provided arguments. Looking at the similar pattern on line 1236, the else branch on line 1243 should concatenate pRootName and buffer without adding a trailing dot (since buffer already ends with a dot based on the condition on line 1234). The format string should remain "%s%s" with two arguments.
| rc = sprintf_s(pFullName, sizeof(pFullName), "%s%s%s", pRootName, buffer); | |
| rc = sprintf_s(pFullName, sizeof(pFullName), "%s%s", pRootName, buffer); |
| else | ||
| { | ||
| rc = sprintf_s(pFullName, sizeof(pFullName), "%s%s", pRootName, buffer); | ||
| rc = sprintf_s(pFullName, sizeof(pFullName), "%s%s%s", pRootName, buffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverity Issue - Missing argument to printf format specifier
No argument for format specifier "%s".
Medium Impact, CWE-685
PRINTF_ARGS
|
Close PR |
DO NOT MERGE